<template>
	<view style="width: 100%;display: flex;flex-direction: column;">
		<view class="main-container">
			<textarea v-model="value" placeholder="输入你的意见或者建议" maxlength='100'>
      </textarea>
			<button @tap="submit" :class="dis" type='primary' hover-class='none'>提交</button>
			<view class="tips">
				<text>你已提交{{count}}次反馈,十分感谢你的合作\n由于服务器很慢,暂不支持上传图片,若有截图请发至QQ:1170917384\n(恶意提交会封禁账号)</text>
			</view>
		</view>
		<view class='footer'>
			<text>
				<text style='color:#d81e06; font-size: 26upx;'> 畅校园一站式校园服务</text>\n\nCopyright© 真皮沙发-Leather Sofa
			</text>
		</view>
	</view>
</template>

<script>
	import utils from "../../static/js/utils.js"
	export default {
		data() {
			return {
				value: "",
				count: 0
			};
		},
		computed:{
			dis(){
				if(this.value.length==0) {
					return "dis";
				}else{
					return "";
				}
			}
		},
		methods: {
			submit() {
				if (this.value.length == 0) {
					utils.errorToast("意见框不能为空");
				} else {
					this.count++;
					uni.setStorageSync("count", this.count);
					utils.successToast("提交成功!");
				}
			}
		},
		onLoad() {
			var count = uni.getStorageSync("count");
			if(count==null) {
				count==0;
			}
			this.count = count;
		}
	}
</script>

<style>
	page {
		background-color: #f2f2f2;
	}

	.main-container {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.main-container textarea {
		border-radius: 6px;
		width: 84%;
		margin-top: 50upx;
		background-color: white;
		height: 400upx;
		padding: 3%;
		font-size: 34upx;
		font-family: 'FangSong'
	}

	.main-container button {
		width: 90%;
		height: 90upx;
		margin-top: 40upx;
		line-height: 90upx;
		font-size: 34upx;
		background-color: #d81e06;
	}

	.tips {
		font-size: 25upx;
		color: #999;
		width: 80%;
		height: 100upx;
		text-align: center;
		margin-top: 160upx;
	}

	.footer {
		width: 100%;
		text-align: center;
		position: absolute;
		bottom: 40upx;
		line-height: 23upx;
	}

	.footer text {
		color: #999;
		font-size: 23upx;
	}
	.dis {
		opacity:0.2;
	}
</style>
